<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<!-- 自定义拦截器后到处方法时忘记吧promise对象return出去 -->
<body>
    <button class="btn">用户注册</button>
    <script  src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script>
    document.querySelector('.btn').addEventListener('click',()=>{
    axios({
        utl:'http://hmajax.itheima.net/api/register',
        method:'post',
        data:{
            username:'tcann890',
            password:'849569',
        // export function resetPassword(data){
        //     request{(
        //         utl:'http://hmajax.itheima.net/api/register',
        //          method:'post',
        //          data
        //     )}
        // }
        }
    }).then(result=>{
        console.log(result)
    }).catch(error=>{
        console.log(error)
        console.log(error.response.data.message)
        alter(error.response.data.message)
    })
    })
    </script>
</body>
</html>